import java.util.Scanner;

public class year{
    public static void main(String[] args) {
        Scanner read=new Scanner(System.in);
        int year, month, day;
        year=read.nextInt();
        month=read.nextInt();
        day=read.nextInt();

        switch (month) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                if (1<=day&&day<31) {
                    day += 1;
                }else if(day==31){
                    if(month==12){
                        year++;
                        month=1;
                        day=1;
                    }

                    month++;
                    day=1;
                }

                break;
            case 4:
            case 6:
            case 9:
            case 11:
                if (1<=day&&day<30) {
                    day+= 1;
                }else if(day==30){
                    month++;
                    day=1;
                }

                break;
            case 2:
                if((year % 4 == 0 && year % 100 != 0) ||year % 400 == 0){
                    //润年
                    if (1<=day&&day<29) {
                        day += 1;
                    }else if(day==29){
                        month++;
                        day=1;
                    }
                }else{
                    //平年
                    if (1<=day&&day<28) {
                        day += 1;
                    }else if(day==28){
                        month++;
                        day=1;
                    }
                }
            break;
        }
        System.out.printf("%d,%d,%d",year,month,day);
    }
}
